Method and apparatus for opening file, and electronic device

ABSTRACT

Embodiments of the present disclosure provide a method and an apparatus for opening a file, and an electronic device. Embodiments of the present disclosure receive the file opening request, obtain the format information of the file to be opened indicated by the file opening request, search for application information of the target application for opening the file to be opened according to the format information, provide the application entry of the target application in the current interface according to the application information, obtain the configuration file corresponding to the target application when the application entry is triggered, and generate the native interface of the target application according to the configuration file and open the file to be opened in the native interface.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims priority to Chinese Patent Application No.201810150628.8, filed Feb. 13, 2018, the entire disclosure of which isincorporated herein by reference.

FIELD

The present disclosure relates to the field of electronic devicetechnologies, and more particularly to a method and an apparatus foropening a file, a storage medium and an electronic device.

BACKGROUND

During using an electronic device, a user may encounter some files withunknown formats. However, the user usually installs some applicationsfor opening files with common formats in the electronic device, whichresults in that the user does not know how to open the file with theunknown format in the electronic device when he encounters the file withthe unknown format.

DISCLOSURE

Embodiments of the present disclosure provide a method and an apparatusfor opening a file, a storage medium and an electronic device, which mayreduce a difficulty of opening a file.

In a first aspect, embodiments of the present disclosure provide amethod for opening a file. The method includes: receiving a file openingrequest, and obtaining format information of a file to be openedindicated by the file opening request; searching for applicationinformation of a target application for opening the file to be openedaccording to the format information; providing an application entry ofthe target application in a current interface according to theapplication information; obtaining a configuration file corresponding tothe target application when the application entry is triggered; andgenerating a native interface of the target application according to theconfiguration file and opening the file to be opened in the nativeinterface.

In a second aspect, embodiments of the present disclosure provide anapparatus for opening a file. The apparatus includes: an informationobtaining module, configured to receive a file opening request, andobtain format information of a file to be opened indicated by the fileopening request; an application searching module, configured to searchfor application information of a target application for opening the fileto be opened according to the format information; an entry displayingmodule, configured to provide an application entry of the targetapplication in a current interface according to the applicationinformation; a file obtaining module, configured to obtain aconfiguration file corresponding to the target application when theapplication entry is triggered;

and an interface displaying module, configured to generate a nativeinterface of the target application according to the configuration fileand open the file to be opened in the native interface.

In a third aspect, embodiments of the present disclosure provide astorage medium. The storage medium is stored thereon with computerprograms that, when running on a computer, cause the computer toimplement the method for opening a file provided by any embodiment ofthe present disclosure.

In a fourth aspect, embodiments of the present disclosure provide anelectronic device. The electronic device includes a memory and aprocessor. The memory has computer programs. The processor is configuredto implement the method for opening a file provided by any embodiment ofthe present disclosure by calling the computer programs.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to more clearly explain technical solutions in embodiments ofthe present disclosure or in the related art, drawings required to beused in description of embodiments of the present disclosure or of therelated art is simply introduced below. Apparently, the drawings in thefollowing description are merely embodiments of the present disclosure.For the ordinary skilled in the art, other drawings may be obtainedbased on these drawings without any creative work.

FIG. 1 is a schematic diagram of an application scenario where a methodfor opening a file according to embodiments of the present disclosure isapplied.

FIG. 2 is a flow chart of a method for opening a file according to anembodiment of the present disclosure.

FIG. 3 is a schematic diagram illustrating an operation of a usertriggering a file opening request according to an embodiment of thepresent disclosure.

FIG. 4 is a schematic diagram illustrating an operation of a usertriggering an application entry according to an embodiment of thepresent disclosure.

FIG. 5 is a flow chart of a method for opening a file according toanother embodiment of the present disclosure.

FIG. 6 is a schematic diagram illustrating an effect in which a file tobe opened has been opened according to an embodiment of the presentdisclosure.

FIG. 7 is a block diagram of an apparatus for opening a file accordingto an embodiment of the present disclosure is applied.

FIG. 8 is a block diagram of an electronic device according to anembodiment of the present disclosure.

FIG. 9 is block diagram of an electronic device according to anotherembodiment of the present disclosure.

EMBODIMENTS OF THE PRESENT DISCLOSURE

Please refer to drawings, in which same reference numbers refer to samecomponents. The principle of the present disclosure is illustratedthrough implementation in a suitable computing environment. Thefollowing description is based on specific embodiments of the presentdisclosure, which should not be interpreted as limitation to otherspecific embodiments of the present disclosure that are not described indetail here.

In the following description, specific embodiments of the presentdisclosure will be illustrated with reference to steps and symbolsexecuted by one or more computers, unless otherwise stated. Thus, thesesteps and operations will be mentioned several times as being executedby the computer. In the present disclosure, being executed by thecomputer includes operations of a computer processor unit representingdata in a structured form. The operations convert the data or maintainthe data at a place in a memory system of the computer, which may bere-configured or change the operation of the computer in a way wellknown by testers in the art. The data structure maintained by the datais the physical position of the memory, which has specificcharacteristics defined by the data format. However, the principle ofthe present disclosure is illustrated in above words, which do notrepresent a limitation. Testers in the art would appreciate that,following blocks and operations may also be implemented in hardware.

The term “module” used in the present disclosure may be regarded assoftware object executed on the operating system. Different components,modules, engines and services described herein may be regarded asimplementation objects on the operating system. Moreover, the apparatusand method described herein may be implemented in a form of software, ormay be implemented on hardware, both of which are in the protectionscope of the present disclosure.

Terms such as “first”, “second” and “third” used in the presentdisclosure are used to distinguish different objects, but are not usedto describe particular order. Furthermore, terms “including” and“having” and their any variants intend to cover non-exclusive inclusion.For example, a process, a method, a system, a product or a deviceincluding a series of steps or modules is not limited to listed steps ormodules, instead further includes steps or modules that are not listedin some embodiments, or further includes other steps or modules inherentto the process, the method, the product or the device.

“Embodiment” mentioned herein means that, particular features,structures or characteristics described in combination with theembodiment may be included in at least one embodiment of the presentdisclosure. This phase appeared at other places in the specificationdoes not refer to the same embodiment, and is not exclusively dependentor alternative embodiment of other embodiments. Those skilled in the artexplicitly or implicitly understand that, the embodiment describedherein may be combined with other embodiments.

Embodiments of the present disclosure provide a method for opening afile. An execution body of the method may be an apparatus for opening afile provided by embodiments of the present disclosure, or an electronicdevice having the apparatus for opening the file, in which the apparatusfor opening the file may be implemented by hardware or software. Theelectronic device may be a smart phone, a tablet computer, a handheldcomputer, a notebook computer, a desktop computer, or other computerdevice.

Please refer to FIG. 1, which is a schematic diagram illustrating anapplication scenario where a method for opening a file provided byembodiments of the present disclosure is applied. For example, theapparatus for opening the file is integrated in the electronic device.The electronic device may receive a file opening request, obtain formatinformation of the file to be opened indicated by the file openingrequest, search for application information of a target application foropening the file to be opened according to the format information,provide an application entry of the target application in a currentinterface according to the application information, obtain aconfiguration file corresponding to the target application when theapplication entry is triggered, and generate a native interface of thetarget application according to the configuration file and open the fileto be opened in the native interface.

In detail, referring to FIG. 1, the file to be opened is for example afile with an unknown format encountered by a user. A request for openingthe file with the unknown format triggered by the user may be received(for example, the user may trigger the request for opening the file withthe unknown format by clicking a file icon of the file with the knownformat), and when the request for opening the file with the known formatis received, the format information of the file with the unknown formatis obtained (the format information is configured to describe a fileformat of the file with the unknown format, for example, the formatinformation includes an extension of the file with the unknown format).Then, application information of a target application for opening thefile to be opened is searched for according to the obtained formatinformation. An application entry of the target application is providedin a current interface according to the found application information(the target application is an application which is not installedcurrently). For example, the application entry of the target applicationmay be superimposed on the file icon of the file with the unknownformat. When the application entry is triggered by the user, aconfiguration file of the target application is further obtainedFinally, a native interface of the target application is generatedaccording to the obtained configuration file, and the file with theunknown format is opened in the generated native interface. The nativeinterface may be colloquially referred to as “fast application”, suchthat even if the target application is not installed, the targetapplication can run.

Please refer to FIG. 2, which is a flow chart of a method for opening afile according to an embodiment of the present disclosure. The methodfor opening a file according to an embodiment of the present disclosuremay include following operations.

At block 201, a file opening request is received, and format informationof a file to be opened indicated by the file opening request isobtained.

In embodiments of the present disclosure, the file opening requesttriggered by the user may be received, and when the file opening requesttriggered by the user is received, format information of the file to beopened indicated by the file opening request is obtained. The user maytrigger the file opening request in various ways based on actual demand.

For example, as illustrated in FIG. 3, file icons of four files (file A,file B, file C, and file D) are displayed in a current interface of theelectronic device. On one hand, when the user is interested in filecontent of file D, he may click the file icon of file D with his finger,to trigger the file opening request, which indicates that file D is thefile to be opened. On the other hand, when the electronic devicereceives the triggered file opening request, the electronic deviceobtains the format information of the file to be opened indicated by thefile opening request, i.e., the format information of file D.

As another example, the user may connect a mouse with the electronicdevice, operate the electronic device via the mouse to select the fileicon corresponding to the file of interest, and trigger the file openingrequest by double clicking the left button on the mouse. The file to beopened indicated by the file opening request is the file correspondingto the file icon selected by the mouse, i.e., the file in which the useris interested now.

As another example, the user may also trigger the file opening requestby inputting a command-line command, which will not be elaborated here.

It is to be noted that, in embodiments of the present disclosure, theformat information obtained is configured to describe the file format ofthe file to be opened. For example, an extension of the file to beopened may be taken as the format information.

In detail, obtaining the format information of the file to be openedindicated by the file opening request includes: obtaining storage pathinformation of the file to be opened; and parsing the storage pathinformation to extract the format information of the file to be openedfrom the storage path information.

The format information is the extension, in which the extension istypically configured to distinguish file formats of different files. Forexample, common extensions of picture files include, but not limited to,.gif, .bmp and .jpeg, common extensions of video files include, but notlimited to, .avi, .mp4 and .mkv, and common extensions of text filesinclude, but not limited to, .txt, .pdf, and .doc.

It is to be noted that, the extension typically exists as a suffix ofthe file, and when obtaining the extension of the file to be opened, thestorage path information of the file to be opened may be obtained first.In detail, in order to clearly indicate the file to opened, the fileopening request further carries the storage path information of the fileto be opened. Thus, the storage path information of the file to beopened may be extracted directly from the file opening request received.After obtaining the storage path information of the file to be opened,the storage path information may be parsed, to extract the extension ofthe file to be opened.

For example, the obtained storage path information of the file to beopened is “C:\Users\DELL3\Desktop\XX.doc”. It can be seen from thestorage path information that, the file to be opened is file XX, whichis saved on the operating system desktop, and the suffix part “.doc” ofthe storage path information is directly extracted as the extension offile XX.

At block 202, application information of a target application foropening the file to be opened is searched for according to the formatinformation.

It is to be noted that, different types of files need to be opened bycorresponding applications. For example, pdf files need to be opened bya PDF reader application.

In detail, searching for application information of the targetapplication for opening the file to be opened according to the formatinformation may include: sending an application search request carryingthe format information to an application server, in which theapplication search request is configured to instruct the applicationserver to search for the application information of the targetapplication; and receiving the application information of the targetapplication returned by the application server.

The application server serves as a “intermediary” between the user andthe developer, and provides platform services for the user and thedeveloper. On one hand, the developer may upload the “fast application”developed by his own to the application server, in which the “fastapplication” is provided to the user for use via a “fast applicationplatform”. On the other hand, the user may find the fast applicationrequired for use via the “fast application plat form”, based on hisdemand.

In embodiments of the present disclosure, searching for the applicationof the target application for opening the file to be opened is aprocedure of searching for the fast application required for use.

In an alternative implementation, the application server stores andmaintains an association relationship between applications and fileformats, in which the association relationship is configured to describewhich type of file can be opened by which application or applications.When searching for the application information of the target applicationfor opening the file to be opened, on one hand, the electronic devicefirst builds the application search request according to a presetmessage format, the application search request at least including theformat information of the file to be opened, and then sends the builtapplication search request to the application server to instruct theapplication server to search for the application information of thetarget application which can open the file to be opened, and receivesthe application information of the target application returned by theapplication server; and on the other hand, after receiving theapplication search request sent by the electronic device, theapplication server finds the application information of the targetapplication which can open the file to be opened (the applicationinformation is configured to describe the target application) accordingto the stored association relationship between applications and fileformats and the format information of the file to be opened parsed fromthe application search request (the format information is configured todescribe the file format of the file to be opened, for example, is theextension), and then returns the found application information of thetarget application to the electronic device.

The application information may be an application identification of thetarget application. The application identification is a character or acharacter string which can be mapped to the target application. Forexample, the application identification may be an application name ofthe target application, a part of the application name, or other termsassociated with the target application, etc.

For example, when the application server finds according to theapplication search request that the target application for opening thefile to be opened is a certain PDF reader application, the applicationserver returns the application name “reader XX” of the PDF readerapplication as the application information of the target application.

In another alternative implementation, the application server does notstore and maintain the association relationship between applications andfile formats. When searching for the application information of thetarget application for opening the file to be opened, on one hand, theelectronic device first builds the application search request accordingto a preset message format, the application search request at leastincluding the application information of the file to be opened, and thensends the built application search request to the application server toinstruct the application server to search for the applicationinformation of the target application which can open the file to beopened, and receives the application information of the targetapplication returned by the application server; and on the other hand,after receiving the application search request sent by the electronicdevice, the application server parses the application informationcarried by the application search request, builds a second applicationsearch request according to the application information, sends the builtsecond application search request to a search server to instruct thesearch server to search for the application information of the targetapplication which can open the file to be opened, and returns theapplication information of the target application to the electronicdevice after receiving the application information of the targetapplication which can open the file to be opened returned by the searchserver.

It is to be noted that, in addition to being associated with the targetapplication, the application information is also associated with thefast application corresponding to the target application. For example,the target application is a reader application A, and the applicationinformation “XX” is associated with both the reader application A andthe fast application A corresponding to the reader application A.

In an embodiment, before searching for the application information ofthe target application for opening the file to be opened according tothe obtained format information, it may be determined whether a defaultapplication associated with the obtained format information has beeninstalled. When there is no installed default application associatedwith the format information, the application information of the targetapplication for opening the file to be opened is searched for accordingto the format information.

In embodiments of the present disclosure, the electronic device storesand maintains an association relationship between file formats anddefault applications for opening different file formats. Determiningwhether a default application associated with the obtained formatinformation has been installed may be performed according to theassociation relationship. When there is no installed default applicationassociated with the format information, it indicates that the electronicdevice cannot open the file to be opened with currently installedapplications, and thus the application information of the targetapplication for opening the file to be opened may be further searchedfor according to the format information, the description of which mayrefer to the above, which is not elaborated here.

At block 203, an application entry of the target application is providedin a current interface according to the application information.

Different display forms of application entries may be provided accordingto different target applications. It is to be noted that, in embodimentsof the present disclosure, the display form of the application entry isnot limited, which may adopt the form of “widget”, or the form of“shortcut”.

For example, as illustrated in FIG. 4, file D is the file to be opened,the obtained application information describes that the targetapplication is a reader application, the application entry of the readerapplication may be provided in the form of widget “read” andsuperimposed on the file icon of file D, and the user may click thedisplayed widget “read” with the finger to trigger the applicationentry.

At block 204, when the application entry of the target application istriggered, a configuration file corresponding to the target applicationis obtained.

In an alternative implementation, obtaining the configuration filecorresponding to the target application includes: when the applicationentry is triggered, sending a configuration file obtaining requestcarrying the application information to the application server, in whichthe configuration file obtaining request is configured to instruct theapplication server to return the configuration file corresponding to thetarget application; and receiving the configuration file correspondingto the target application returned by the application server.

The configuration file corresponding to the target application is theconfiguration file of the fast application corresponding to the targetapplication. The configuration file is provided for the electronicdevice to generate and display a native interface of the targetapplication, such that even if the application has not been installed,the electronic device may achieve an operation effect same as if thetarget application has been installed.

In detail, the configuration file includes a statement describing aninterface of the target application. The statement includes datarequired for displaying the interface and run logic of the interface.

Such data may include display elements required to be displayed in theinterface of the target application, layout information of the displayelements, and resource addresses required for displaying the displayelements, and the like. The layout information may include informationsuch as positions, sizes and colors of respective display elements. Theresource addresses may be addresses of local resources of the electronicdevice or link addresses of resources stored in the application server.

The foregoing run logic may include interface addresses jumped to whenclicking the display elements, or operations required to execute forclicking the display elements, or operations required to execute forother user operations.

It is to be noted that, the foregoing data and run logic may beimplemented based on JavaScript language.

In another alternative implementation, before obtaining theconfiguration file corresponding to the target application when theapplication entry of the target application is triggered, followingoperations may be performed:

sending the configuration file obtaining request carrying theapplication information to the application server, the configurationfile obtaining request being configured to instruct the applicationserver to return the configuration file corresponding to the targetapplication; and

caching the configuration file corresponding to the target applicationreturned by the application server.

Obtaining the configuration file corresponding to the target applicationwhen the application entry of the target application is triggeredincludes: obtaining the cached configuration file when the applicationentry of the target application is triggered.

The configuration file obtaining request carrying the applicationinformation of the target application may be first sent to theapplication server, in which the configuration file obtaining request isconfigured to instruct the application server to return theconfiguration file corresponding to the target application.

Then, the configuration file corresponding to the target applicationreturned by the application server is received, and the receivedconfiguration file is cached into a preset cache region. It is to benoted that, in embodiments of the present disclosure, the size and thepath of the cache region is not limited, and may be set by those skilledin the art based on actual demand.

Then, since the configuration file corresponding to the targetapplication has been cached in the local cache region, the configurationfile corresponding to the target application can be obtained from thecache region when the application entry of the target application istriggered.

At block 205, the native interface of the target application isgenerated according to the configuration file, and the file to be openedis opened in the native interface.

The electronic device calls the framework file built in the operatingsystem according to the configuration file corresponding to the targetapplication (i.e., the configuration file of the fast applicationcorresponding to the target application), to parse the foregoingstatement. The framework file would parse the statement in theconfiguration file into display elements, convert the parsed displayelements into a native view of the target application according to acorrespondence relationship between the display elements and the nativeview of the target application provided in the framework file, andperform local rendering according to the converted native view, togenerate the interface of the fast application corresponding to thetarget application, i.e., the native interface of the targetapplication.

Then, the file to be opened may be opened in the native interface of thetarget application. In detail, in an alternative implement, opening thefile to be opened in the native interface of the target applicationincludes: uploading the file to be opened to the application server, toinstruct the application server to return file content obtained byopening the file to be opened; receiving the file content returned bythe application server; and displaying the received file content in thenative interface.

The electronic device does not actually undertake the task of openingthe file to be opened, but is merely responsible for generating thenative interface of the target application and displaying the filecontent of the file to be opened. In detail, on one hand, the electronicdevice uploads the file to be opened to the application server, andwaits to receive the file content returned by the application server,which is obtained by opening the file to be opened; on the other hand,after receiving the file to be opened uploaded by the electronic device,the application server parses the file to be opened with the fileparsing service of the target application, and returns the parsed filecontent to the electronic device.

In another alternative implementation, opening the file to be opened inthe native interface of the target application includes: enabling thefile parsing service of the target application according to theconfiguration file corresponding to the target application; parsing thefile to be opened with the file parsing service to obtain the filecontent of the file to be opened; and displaying the file content in thenative interface.

The difference from the forgoing implementation lies in that, theelectronic device undertakes the task of opening the file to be openedin addition to undertaking the task of generating the native interfaceof the target application. In detail, the configuration file furtherincludes a code file for running the file parsing service of the targetapplication. With the file parsing service, the file to be opened may beparsed to obtain the file content of the file to be opened. While thenative interface of the target application is generated, the code filecorresponding to the file parsing service in the configuration file isexecuted, to enable the file parsing service of the target application,such that the file to be opened is parsed with the file parsing serviceto obtain the file content of the file to be opened Finally, the parsedfile content is displayed in the native interface of the targetapplication. Thus, the operation of “opening” the file to be opened iscompleted.

In embodiments of the present disclosure, after opening the file to beopened in the native interface, the cached configuration file is deletedwhen the native interface is closed.

In embodiments of the present disclosure, the electronic device furtherdetects a state of the native interface in real time, and deletes thecached configuration file when detecting that the native interface isclosed, thus releasing the storage resource occupied by theconfiguration file.

For example, after viewing the file content via the native interface ofthe target application, the user may operate the electronic device toclose the native interface of the target application. Accordingly, whenthe electronic device identifies that the native interface of the targetapplication is closed, the electronic device deletes the configurationfile of the target application cached in the cache region.

In conclusion, embodiments of the present disclosure receive the fileopening request, obtain the format information of the file to be openedindicated by the file opening request, search for applicationinformation of the target application for opening the file to be openedaccording to the format information, provide the application entry ofthe target application in the current interface according to theapplication information, obtain the configuration file corresponding tothe target application when the application entry is triggered, andgenerate the native interface of the target application according to theconfiguration file and open the file to be opened in the nativeinterface. With the technical solutions of the present disclosure, thefile to be opened can be opened quickly. Even if the file to be openedhas an unknown format, it is not necessary to download and install anadditional application, which reduces the difficulty of opening thefile.

In the following, the method for opening the file of the presentdisclosure will be further illustrated based on above embodiments. Indetail, referring to FIG. 5, the method for opening the file may includefollowings.

At block 301, a file opening request is received, and format informationof a file to be opened indicated by the file opening request isobtained.

In embodiments of the present disclosure, the file opening requesttriggered by the user may be received, and when the file opening requesttriggered by the user is received, format information of the file to beopened indicated by the file opening request is obtained. The user maytrigger the file opening request in various ways based on actual demand.

For example, as illustrated in FIG. 3, file icons of four files (file A,file B, file C, and file D) are displayed in a current interface of theelectronic device. On one hand, when the user is interested in filecontent of file D, he may click the file icon of file D with his finger,to trigger the file opening request, which indicates that file D is thefile to be opened. On the other hand, when the electronic devicereceives the triggered file opening request, the electronic deviceobtains the format information of the file to be opened indicated by thefile opening request, i.e., the format information of file D.

As another example, the user may connect a mouse with the electronicdevice, operate the electronic device via the mouse to select the fileicon corresponding to the file of interest, and trigger the file openingrequest by double clicking the left button on the mouse. The file to beopened indicated by the file opening request is the file correspondingto the file icon selected by the mouse, i.e., the file in which the useris interested now.

As another example, the user may also trigger the file opening requestby inputting a command-line command, which will not be elaborated here.

It is to be noted that, in embodiments of the present disclosure, theformat information obtained is configured to describe the file format ofthe file to be opened. For example, an extension of the file to beopened may be taken as the format information.

In detail, obtaining the format information of the file to be openedindicated by the file opening request includes: obtaining storage pathinformation of the file to be opened; and parsing the storage pathinformation to extract the format information of the file to be openedfrom the storage path information.

The format information is the extension, in which the extension istypically configured to distinguish file formats of different files. Forexample, common extensions of picture files include, but not limited to,.gif, .bmp and .jpeg, common extensions of video files include, but notlimited to, .avi, .mp4 and .mkv, and common extensions of text filesinclude, but not limited to, .txt, .pdf, and .doc.

It is to be noted that, the extension typically exists as a suffix ofthe file, and when obtaining the extension of the file to be opened, thestorage path information of the file to be opened may be obtained first.In detail, in order to clearly indicate the file to opened, the fileopening request further carries the storage path information of the fileto be opened. Thus, the storage path information of the file to beopened may be extracted directly from the file opening request received.After obtaining the storage path information of the file to be opened,the storage path information may be parsed, to extract the extension ofthe file to be opened.

For example, the obtained storage path information of the file to beopened is “C:\Users\DELL3\Desktop\XX.doc”. It can be seen from thestorage path information that, the file to be opened is file XX, whichis saved on the operating system desktop, and the suffix part “.doc” ofthe storage path information is directly extracted as the extension offile XX.

At block 302, an application search request is sent to an applicationserver according to the format information of the file to be opened, andapplication information of a target application returned by theapplication server according to the application search request isreceived, in which the target application is the application for openingthe file to be opened.

The application server serves as a “intermediary” between the user andthe developer, and provides platform services for the user and thedeveloper. On one hand, the developer may upload the “fast application”developed by his own to the application server, in which the “fastapplication” is provided to the user for use via a “fast applicationplatform”. On the other hand, the user may find the fast applicationrequired for use via the “fast application plat form”, based on hisdemand.

In embodiments of the present disclosure, searching for the applicationof the target application for opening the file to be opened is aprocedure of searching for the fast application required for use.

In an alternative implementation, the application server stores andmaintains an association relationship between applications and fileformats, in which the association relationship is configured to describewhich type of file can be opened by which application or applications.When searching for the application information of the target applicationfor opening the file to be opened, on one hand, the electronic devicefirst builds the application search request according to a presetmessage format, the application search request at least including theformat information of the file to be opened, and then sends the builtapplication search request to the application server to instruct theapplication server to search for the application information of thetarget application which can open the file to be opened, and receivesthe application information of the target application returned by theapplication server; and on the other hand, after receiving theapplication search request sent by the electronic device, theapplication server finds the application information of the targetapplication which can open the file to be opened (the applicationinformation is configured to describe the target application) accordingto the stored association relationship between applications and fileformats and the format information of the file to be opened parsed fromthe application search request (the format information is configured todescribe the file format of the file to be opened, for example, is theextension), and then returns the found application information of thetarget application to the electronic device.

The application information may be an application identification of thetarget application. The application identification is a character or acharacter string which can be mapped to the target application. Forexample, the application identification may be an application name ofthe target application, a part of the application name, or other termsassociated with the target application, etc.

For example, when the application server finds according to theapplication search request that the target application for opening thefile to be opened is a certain PDF reader application, the applicationserver returns the application name “reader XX” of the PDF readerapplication as the application information of the target application.

In another alternative implementation, the application server does notstore and maintain the association relationship between applications andfile formats. When searching for the application information of thetarget application for opening the file to be opened, on one hand, theelectronic device first builds the application search request accordingto a preset message format, the application search request at leastincluding the application information of the file to be opened, and thensends the built application search request to the application server toinstruct the application server to search for the applicationinformation of the target application which can open the file to beopened, and receives the application information of the targetapplication returned by the application server; and on the other hand,after receiving the application search request sent by the electronicdevice, the application server parses the application informationcarried by the application search request, builds a second applicationsearch request according to the application information, sends the builtsecond application search request to a search server to instruct thesearch server to search for the application information of the targetapplication which can open the file to be opened, and returns theapplication information of the target application to the electronicdevice after receiving the application information of the targetapplication which can open the file to be opened returned by the searchserver.

It is to be noted that, in addition to being associated with the targetapplication, the application information is also associated with thefast application corresponding to the target application. For example,the target application is a reader application A, and the applicationinformation “XX” is associated with both the reader application A andthe fast application A corresponding to the reader application A.

At block 303, a configuration file obtaining request is sent to theapplication server according to the application information of thetarget application.

The configuration file obtaining request carrying the applicationinformation of the target application may be first sent to theapplication server, in which the configuration file obtaining request isconfigured to instruct the application server to return theconfiguration file corresponding to the target application.

The configuration file corresponding to the target application is theconfiguration file of the fast application corresponding to the targetapplication. The configuration file is provided for the electronicdevice to generate and display a native interface of the targetapplication, such that even if the application has not been installed,the electronic device may achieve an operation effect same as if thetarget application has been installed.

In detail, the configuration file includes a statement describing aninterface of the target application. The statement includes datarequired for displaying the interface and run logic of the interface.

Such data may include display elements required to be displayed in theinterface of the target application, layout information of the displayelements, and resource addresses required for displaying the displayelements, and the like. The layout information may include informationsuch as positions, sizes and colors of respective display elements. Theresource addresses may be addresses of local resources of the electronicdevice or link addresses of resources stored in the application server.

The foregoing run logic may include interface addresses jumped to whenclicking the display elements, or operations required to execute forclicking the display elements, or operations required to execute forother user operations.

It is to be noted that, the foregoing data and run logic may beimplemented based on JavaScript language.

At block 304, a configuration file corresponding to the targetapplication returned by the application server according to theconfiguration file obtaining request is cached.

In embodiments of the present disclosure, after sending theconfiguration file obtaining request to the application server, theelectronic device waits to receive the configuration file correspondingto the target application returned by the application server, and cachesthe configuration file into the preset cache region when receiving theconfiguration file corresponding to the target application returned bythe application server. In embodiments of the present disclosure, thesize and the path of the cache region is not limited, and may be set bythose skilled in the art based on actual demand.

At block 305, an application entry of the target application is providedin a current interface according to the application information of thetarget application.

Different display forms of application entries may be provided accordingto different target applications. It is to be noted that, in embodimentsof the present disclosure, the display form of the application entry isnot limited, which may adopt the form of “widget”, or the form of“shortcut”.

For example, as illustrated in FIG. 4, file D is the file to be opened,the obtained application information describes that the targetapplication is a reader application, the application entry of the readerapplication may be provided in the form of widget “read” andsuperimposed on the file icon of file D, and the user may click thedisplayed widget “read” with the finger to trigger the applicationentry.

At block 306, when the application entry of the target application istriggered, the cached configuration file corresponding to the targetapplication is obtained.

In embodiments of the present disclosure, since the configuration filecorresponding to the target application has been cached in the localcache region, the configuration file corresponding to the targetapplication can be obtained from the cache region when the applicationentry of the target application is triggered.

At block 307, a native interface of the target application is generatedaccording to the configuration file, and the file to be opened isuploaded to the application server, and file content of the file to beopened returned by the application server is received.

The electronic device calls the framework file built in the operatingsystem according to the configuration file corresponding to the targetapplication (i.e., the configuration file of the fast applicationcorresponding to the target application), to parse the foregoingstatement. The framework file would parse the statement in theconfiguration file into display elements, convert the parsed displayelements into a native view of the target application according to acorrespondence relationship between the display elements and the nativeview of the target application provided in the framework file, andperform local rendering according to the converted native view, togenerate the interface of the fast application corresponding to thetarget application, i.e., the native interface of the targetapplication.

In embodiments of the present disclosure, while the native interface isgenerated, or after the native interface is generated, the file to beopened is uploaded to the application server, to instruct theapplication server to return the file content obtained from opening thefile to be opened. In detail, on one hand, the electronic device uploadsthe file to be opened to the application server, and waits to receivethe file content returned by the application server, which is obtainedby opening the file to be opened; on the other hand, after receiving thefile to be opened uploaded by the electronic device, the applicationserver parses the file to be opened with the file parsing service of thetarget application, and returns the parsed file content to theelectronic device.

At block 309, the received file content is displayed in the nativeinterface.

In embodiments of the present disclosure, after receiving the filecontent of the file to be opened returned by the application server, thereceived file content may be displayed in the native interface of thetarget application.

For example, as illustrated in FIG. 6, the electronic device displaysthe file content of the file to be opened “file D” in the generatednative interface of the target application.

In conclusion, embodiments of the present disclosure receive the fileopening request, obtain the format information of the file to be openedindicated by the file opening request, search for applicationinformation of the target application for opening the file to be openedaccording to the format information, provide the application entry ofthe target application in the current interface according to theapplication information, obtain the configuration file corresponding tothe target application when the application entry is triggered, andgenerate the native interface of the target application according to theconfiguration file and open the file to be opened in the nativeinterface. With the technical solutions of the present disclosure, thefile to be opened can be opened quickly. Even if the file to be openedhas an unknown format, it is not necessary to download and install anadditional application, which reduces the difficulty of opening thefile.

In an embodiment, an apparatus for opening a file is provided. Pleaserefer to FIG. 7, which is a block diagram of an apparatus 400 foropening a file according to an embodiment of the present disclosure. Theapparatus 400 is applicable to an electronic device. The apparatus 400includes an information obtaining module 401, an application searchingmodule 402, an entry displaying module 403, a file obtaining module 404and an interface displaying module 405.

The information obtaining module 401 is configured to receive a fileopening request, and obtain format information of a file to be openedindicated by the file opening request.

The application searching module 402 is configured to search forapplication information of a target application for opening the file tobe opened according to the format information.

The entry displaying module 403 is configured to provide an applicationentry of the target application in a current interface according to theapplication information.

The file obtaining module 404 is configured to obtain a configurationfile corresponding to the target application when the application entryis triggered.

The interface displaying module 405 is configured to generate a nativeinterface of the target application according to the configuration fileand open the file to be opened in the native interface.

In an embodiment, the application searching module 402 is furtherconfigured to: send an application search request carrying the formatinformation to an application server, in which the application searchrequest is configured to instruct the application server to search forapplication information of the target application; and receive theapplication information of the target application returned by theapplication server.

In an embodiment, the apparatus 400 further includes a file cachingmodule. The file caching module is configured to: send a configurationfile obtaining request carrying the application information to theapplication server, in which the configuration file obtaining request isconfigured to instruct the application server to return theconfiguration file corresponding to the target application; and cachethe configuration file corresponding to the target application returnedby the application server. The file obtaining module 404 is furtherconfigured to obtain the cached configuration file corresponding to thetarget application when the application entry of the target applicationis triggered.

In an embodiment, the file caching module is further configured todelete the cached configuration file when the native interface of thetarget application is closed.

In an embodiment, the interface displaying module is further configuredto: upload the file to be opened to the application server, to instructthe application server to return file content obtained by opening thefile to be opened; receive the file content returned by the applicationserver; and displaying the received file content in the nativeinterface.

In an embodiment, the interface displaying module 405 is furtherconfigured to: enable a file parsing service of the target applicationaccording to the configuration file; parsing the file to be opened withthe file parsing service, to obtain the file content of the file to beopened; and displaying the parsed file content in the native interface.

In an embodiment, the information obtaining module 401 is furtherconfigured to obtain storage path information of the file to be opened,and parse the storage path information to extract the format informationof the file to be opened from the storage path information.

In specific implementation, above modules may be implemented as separateentities, or may be combined arbitrarily to be implemented as a singleentity or several entities. Specific implementation of above modules mayrefer to foregoing embodiments, which will not be elaborated here.

In conclusion, with the apparatus 400 for opening the file according tothis embodiment, the information obtaining module 401 receives the fileopening request, and obtains the format information of the file to beopened indicated by the file opening request, the application searchingmodule 402 searches for application information of the targetapplication for opening the file to be opened according to the formatinformation, the entry displaying module 403 provides the applicationentry of the target application in the current interface according tothe application information, the file obtaining module 404 obtains theconfiguration file corresponding to the target application when theapplication entry is triggered, and the interface displaying module 405generates the native interface of the target application according tothe configuration file and opens the file to be opened in the nativeinterface. With the technical solutions of the present disclosure, thefile to be opened can be opened quickly. Even if the file to be openedhas an unknown format, it is not necessary to download and install anadditional application, which reduces the difficulty of opening thefile.

Embodiments of the present disclosure further provide an electronicdevice. Referring to FIG. 8, the electronic device includes a processor501 and a memory 502. The processor 501 is electrically connected withthe memory 502.

The processor 500 is a control center of the electronic device 500, isconnected with various parts of the electronic device via variousinterfaces and lines, and executes various functions of the electronicdevice 500 and processes data by running or loading computer programsstored in the memory 502 and calling the data stored in the memory 502,realizing automatic change of material information of the electronicdevice.

The memory 502 may be configured to store software programs and modules.The processor 501 executes various function applications and processesdata by running the computer programs and modules stored in the memory502. The memory 502 may mainly include a program storage region, and adata storage region. The program storage region may store the operatingsystem, computer programs required by at least one functions (forexample, a sound playback function, an image playback function, etc.),and the like. The data storage region may store data establishedaccording to usage of the electronic device. In addition, the memory 502may include a high speed random access memory, or may include anon-volatile memory, for example at least one disk memory device, flashmemory device, or other volatile solid storage devices. Accordingly, thememory 502 may further include a memory controller, for providing accessof the processor 501 to the memory 502.

In embodiments of the present disclosure, the processor 501 in theelectronic device 500 may load the instructions corresponding to one ormore computer programs into the memory 502, and runs the computerprograms stored in the memory 502 to realize various functions, asfollows:

receiving a file opening request, and obtaining format information of afile to be opened indicated by the file opening request;

searching for application information of a target application foropening the file to be opened according to the format information;

providing an application entry of the target application in a currentinterface according to the application information;

obtaining a configuration file corresponding to the target applicationwhen the application entry is triggered; and

generating a native interface of the target application according to theconfiguration file and opening the file to be opened in the nativeinterface.

In some implementations, when searching for application information ofthe target application for opening the file to be opened according tothe format information, the processor 501 may perform:

sending an application search request carrying the format information toan application server, wherein the application search request isconfigured to instruct the application server to search for theapplication information; and receiving the application informationreturned by the application server.

In some implementations, before obtaining the configuration filecorresponding to the target application when the application entry istriggered, the processor 501 may further perform:

sending a configuration file obtaining request carrying the applicationinformation to the application server, wherein the configuration fileobtaining request is configured to instruct the application server toreturn the configuration file corresponding to the target application;and caching the configuration file corresponding to the targetapplication returned by the application server.

When obtaining the configuration file corresponding to the targetapplication, the processor 501 may perform:

obtaining the cached configuration file when the application entry istriggered.

In some implementations, after opening the file to be opened in thenative interface, the processor 501 may further perform: deleting thecached configuration file when the native interface is closed.

In some implementations, when opening the file to be opened in thenative interface, the processor 501 may perform:

uploading the file to be opened to the application server, to instructthe application server to return file content obtained by opening thefile to be opened;

receiving the file content returned by the application server; and

displaying the file content in the native interface.

In some implementations, when opening the file to be opened in thenative interface, the processor 501 may perform:

enabling a file parsing service of the target application according tothe configuration file;

parsing the file to be opened with the file parsing service to obtainfile content of the file to be opened; and

displaying the file content in the native interface.

In some implementations, when obtaining format information of the fileto be opened indicated by the file opening request, the processor 501may perform:

obtaining storage path information of the file to be opened; and

parsing the storage path information, to obtain the format informationof the file to be opened from the storage path information.

In conclusion, embodiments of the present disclosure receive the fileopening request, obtain the format information of the file to be openedindicated by the file opening request, search for applicationinformation of the target application for opening the file to be openedaccording to the format information, provide the application entry ofthe target application in the current interface according to theapplication information, obtain the configuration file corresponding tothe target application when the application entry is triggered, andgenerate the native interface of the target application according to theconfiguration file and open the file to be opened in the nativeinterface. With the technical solutions of the present disclosure, thefile to be opened can be opened quickly. Even if the file to be openedhas an unknown format, it is not necessary to download and install anadditional application, which reduces the difficulty of opening thefile.

Referring to FIG. 9 together, in some implementations, the electronicdevice 500 may further include a display 503, a RF circuit 504, an audiocircuit 505 and a power supply 506. The display 503, the RF circuit 504,the audio circuit 505 and the power supply are electrically connectedwith the processor 501.

The display 503 may be configured to display information input by theuser or information provided to the user and various graphic userinterfaces. These graphic user interfaces may consist of graphs, text,icons, videos and any combination thereof. The display 503 may include adisplay panel, which may be configured in a form of LCD (Liquid CrystalDisplay) or OLED (Organic Light-Emitting Diode) in some implementations.

The RF circuit 504 may be configured to transmit and receive RF signals,to establish wireless communication with a network device or otherelectronic devices, and transmit signals to and receive signals from thenetwork device or other electronic devices.

The audio circuit 505 may be configured to provide an audio interfacebetween the user and the electronic device via a speaker or amicrophone.

The power supply 506 may be configured to supply power for respectiveparts of the electronic device 500. In some embodiments, the powersupply 506 may be logically connected with the processor 501 via a powermanagement system, such that functions such as charging and dischargingmanagement and power management may be realized through the powermanagement system.

Although not shown in FIG. 9, the electronic device 500 may furtherinclude a camera, a Bluetooth module, and the like, which will not beelaborated here.

Embodiments of the present disclosure further provide a storage medium.The storage medium is stored with computer programs that, when runningon a computer, cause the computer to perform the method for opening thefile in any of above embodiments, for example: receiving a file openingrequest, and obtaining format information of a file to be openedindicated by the file opening request; searching for applicationinformation of a target application for opening the file to be openedaccording to the format information; providing an application entry ofthe target application in a current interface according to theapplication information; obtaining a configuration file corresponding tothe target application when the application entry is triggered; andgenerating a native interface of the target application according to theconfiguration file and opening the file to be opened in the nativeinterface.

In embodiments of the present disclosure, the storage medium may be adiskette, a CD, a RAM (Random Access Memory), a ROM (Read Only Memory),or the like.

Description of above embodiments focuses differently. For the part whichis not described in detail in a certain embodiment, reference may bemade to related description in other embodiments.

It is to be noted that, with respect to the method for opening the fileaccording to embodiments of the present disclosure, those skilled in theart may understand that, all or a part of procedures of the method foropening the file according to embodiments of the present disclosure maybe implemented by controlling related hardware through computerprograms. The computer programs may be stored in a computer readablestorage medium, for example, is stored in a memory of an electronicdevice, and is executed by at least one processor in the electronicdevice, the execution process of which may include the process of themethod for opening the file. The storage medium may be a diskette, a CD,a ROM, a RAM and the like.

With respect to the apparatus for opening the file according toembodiments of the present disclosure, respective function modules maybe integrated into one processing chip, or respective function modulesmay exist physically separately, or two or more modules may beintegrated into one module. The integrated module may be implemented ina form of hardware, or may be implemented in a form of software functionmodule. When the integrated module is implemented in the form ofsoftware function module, the integrated module may be sold or used as aseparate product, or may be stored in a computer readable storagemedium, which may be a ROM, a disk or a CD.

The method and apparatus for opening the file, the storage medium andthe electronic device provided by embodiments of the present disclosurehave been described in detail above. Specific examples have been adoptedherein to explain the principle and implementations of the presentdisclosure. Above embodiments are merely illustrated to helpunderstanding of the present method and the core idea thereof. Moreover,for those skilled in the art, specific implementations and applicationscope may vary based on the idea of the present disclosure. Inconclusion, content of the specification should not be interpreted aslimitation to the present disclosure.

What is claimed is:
 1. A method for opening a file, comprising:receiving a file opening request, and obtaining format information of afile to be opened indicated by the file opening request; searching forapplication information of a target application for opening the file tobe opened according to the format information; providing an applicationentry of the target application in a current interface according to theapplication information; obtaining a configuration file corresponding tothe target application when the application entry is triggered; andgenerating a native interface of the target application according to theconfiguration file and opening the file to be opened in the nativeinterface.
 2. The method according to claim 1, wherein searching forapplication information of the target application for opening the fileto be opened according to the format information comprises: sending anapplication search request carrying the format information to anapplication server, wherein the application search request is configuredto instruct the application server to search for the applicationinformation; and receiving the application information returned by theapplication server.
 3. The method according to claim 2, before obtainingthe configuration file corresponding to the target application when theapplication entry is triggered, further comprising: sending aconfiguration file obtaining request carrying the applicationinformation to the application server, wherein the configuration fileobtaining request is configured to instruct the application server toreturn the configuration file corresponding to the target application;and caching the configuration file corresponding to the targetapplication returned by the application server; wherein obtaining theconfiguration file corresponding to the target application when theapplication entry is triggered comprises: obtaining the cachedconfiguration file when the application entry is triggered.
 4. Themethod according to claim 3, after opening the file to be opened in thenative interface, further comprising: deleting the cached configurationfile when the native interface is closed.
 5. The method according toclaim 2, wherein opening the file to be opened in the native interfacecomprises: uploading the file to be opened to the application server, toinstruct the application server to return file content obtained byopening the file to be opened; receiving the file content returned bythe application server; and displaying the file content in the nativeinterface.
 6. The method according to claim 1, wherein opening the fileto be opened in the native interface comprises: enabling a file parsingservice of the target application according to the configuration file;parsing the file to be opened with the file parsing service to obtainfile content of the file to be opened; and displaying the file contentin the native interface.
 7. The method according to claim 1, whereinobtaining format information of the file to be opened indicated by thefile opening request comprises: obtaining storage path information ofthe file to be opened; and parsing the storage path information, toobtain the format information of the file to be opened from the storagepath information.
 8. The method according to claim 1, furthercomprising: determining whether there is an installed defaultapplication associated with the format information before searching forthe application information of the target application for opening thefile to be opened according to the format information; searching for theapplication information of the target application for opening the fileto be opened according to the format information comprises: when thereis no installed default application associated with the formatinformation, searching for the application information of the targetapplication for opening the file to be opened according to the formatinformation.
 9. The method according to claim 1, wherein the applicationentry is displayed in a form of widget, or in a form of shortcut.
 10. Anapparatus for opening a file, comprising: a processor; and a memory,configured to store instructions executable by the processor, whereinthe processor is configured to run a program corresponding to theinstructions by reading the instructions stored in the memory, so as toperform: receiving a file opening request, and obtaining formatinformation of a file to be opened indicated by the file openingrequest; searching for application information of a target applicationfor opening the file to be opened according to the format information;providing an application entry of the target application in a currentinterface according to the application information; obtaining aconfiguration file corresponding to the target application when theapplication entry is triggered; and generating a native interface of thetarget application according to the configuration file and open the fileto be opened in the native interface.
 11. The apparatus according toclaim 10, wherein the processor is configured to perform: sending anapplication search request carrying the format information to anapplication server, wherein the application search request is configuredto instruct the application server to search for the applicationinformation; and receiving the application information returned by theapplication server.
 12. The apparatus according to claim 11, wherein theprocessor is further configured to perform: sending a configuration fileobtaining request carrying the application information to theapplication server, wherein the configuration file obtaining request isconfigured to instruct the application server to return theconfiguration file corresponding to the target application; caching theconfiguration file corresponding to the target application returned bythe application server; and obtaining the cached configuration file whenthe application entry is triggered.
 13. The apparatus according to claim12, wherein the processor is further configured to perform: deleting thecached configuration file when the native interface is closed.
 14. Theapparatus according to claim 11, wherein the processor is configured toperform: uploading the file to be opened to the application server, toinstruct the application server to return file content obtained byopening the file to be opened; receiving the file content returned bythe application server; and displaying the file content in the nativeinterface.
 15. The apparatus according to claim 10, wherein theprocessor is configured to perform: enabling a file parsing service ofthe target application according to the configuration file; parsing thefile to be opened with the file parsing service to obtain file contentof the file to be opened; and displaying the file content in the nativeinterface.
 16. The apparatus according to claim 10, wherein theprocessor is configured to perform: obtaining storage path informationof the file to be opened; and parsing the storage path information, toobtain the format information of the file to be opened from the storagepath information.
 17. The apparatus according to claim 10, wherein theprocessor is further configured to perform: determining whether there isan installed default application associated with the format informationbefore searching for the application information of the targetapplication for opening the file to be opened according to the formatinformation; and when there is no installed default applicationassociated with the format information, searching for the applicationinformation of the target application for opening the file to be openedaccording to the format information.
 18. The apparatus according toclaim 10, wherein the processor is configured to display the applicationentry in a form of widget, or in a form of shortcut.
 19. An electronicdevice, comprising a processor, a memory and a display, wherein thememory is configured to store computer programs, the display isconfigured to receive inputted information and display outputtedinformation, and the processor is configured to implement a method foropening a file by calling the computer programs, the method comprising:receiving a file opening request, and obtaining format information of afile to be opened indicated by the file opening request; searching forapplication information of a target application for opening the file tobe opened according to the format information; providing an applicationentry of the target application in a current interface according to theapplication information; obtaining a configuration file corresponding tothe target application when the application entry is triggered; andgenerating a native interface of the target application according to theconfiguration file and opening the file to be opened in the nativeinterface.
 20. The electronic device according to claim 19, wherein theelectronic device comprises at least one of a smart phone, a tabletcomputer, a personal digital assistant and a wearable device.